package com.inteligencia.stage.dataaccess.base;

import java.io.Serializable;
import java.util.List;
import org.hibernate.criterion.Criterion;
import org.hibernate.criterion.DetachedCriteria;

/**
 *
 * @author pcmd05b
 */
public interface GenericDAO <T,ID extends Serializable> {

    public Class<T> getPersistentClass();

    public void delete(final T entity);

    public List<T> executeQuery(final String queryString);

    public List<T> executeSQLQuery(final String queryString);

    public List<T> listByCriteria(DetachedCriteria c);

    public List<T> findbyCriterion(final Criterion... criterions);

    public List<T> findbyNamedParam(final String query, final String[] named, final Object[]  values);

    public List<T> findbyNamedOneParam(final String query, final String named, final Object values);

    public T get(final ID id);

    public ID insert(final T entity);

    public T merge(final T entity);

    public void saveOrUpdate(final T entity);

    public void update(final T entity);

    public List<T> getAll();

    public int deleteById(final ID id);

    //Para Auditoria
    public void auditSave(final T entity);
    public void auditUpdate(final T entity);
    public T auditMerge(final T entity);
}